package com.lqkj.maptest.service.impl;

import com.lqkj.maptest.entity.User;
import com.lqkj.maptest.mapper.UserMapper;
import com.lqkj.maptest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;


/**
 * @author Linm
 * @title
 * @date 2021/8/4 20:54
 */
@Service
public class UserServiceImpl implements UserService {

    /**
     * userMapper
     */
    @Autowired
    private UserMapper userMapper;


    @Override
    public List<User> findAll(Integer pageNum,
                              Integer pageSize) {
        if(pageNum<1){
          pageNum = 0;
        }else {
            pageNum = (pageNum-1)*pageSize;
        }
        return userMapper.findAll(pageNum,pageSize);
    }

    @Override
    public Integer addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public Integer batchAddUser( List<User> users) {
        return userMapper.batchAddUser(users);
    }

    @Override
    public Integer deleteUser(User user) {
        return userMapper.deleteUser(user);
    }

    @Override
    public Integer updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public Integer batchDeleteUser(Integer[] ids) {
        return userMapper.batchDeleteUser(ids);
    }

    @Override
    public Integer batchUpdateUser(List<User> users) {
        return userMapper.batchUpdateUser(users);
    }


}
